home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / COMMUNIC / MRUN211.ZIP / MRUN211C.WAS < prev    next >
Text File  |  1993-05-01  |  24KB  |  915 lines

  1. ;MailRun v2.11:  Part C, changebbs
  2. ;1992-1993 Gerald P. Sully, all rights reserved.
  3.  
  4. #comment
  5. **************************************************************************
  6. **************************************************************************
  7. * This file contains routines related to changing BBS settings.
  8. * Settings are divided into three groups, each with its own
  9. * dialog box:  BBS Settings, BBS Prompts, and Mail Door Prompts.
  10. * The appropriate routine is selected with a FLAG.
  11. **************************************************************************
  12. **************************************************************************
  13. #endcomment
  14.  
  15. #define MRUN211C
  16. #define MRUN211BC
  17.  
  18. #include "mrun211.h"
  19.  
  20. string ProtList, ArcList, MailDoorList, BBSTypeList, BBSChoice
  21.  
  22.  
  23. #comment
  24. *********************************************************************
  25. * MAIN()
  26. * Calls checkchild(), makemaildoorlist(), menudim(),
  27. * makebbstypelist(), makeprotlist(), changeprompts(),
  28. * changeuserinfo(), changemaildoor()
  29. * Dispatches the appropriate command based on the value
  30. * of FLAGS.
  31. *********************************************************************
  32. #endcomment
  33.  
  34. proc main
  35. integer cmdstatus
  36.     menudim()
  37.     checkchild()
  38.     findfirst MailRun
  39.     MailRunTrunc = $FILENAME
  40.     makeprotlist()
  41.     makebbstypelist()
  42.     makemaildoorlist()
  43.     cmdstatus = FLAGS & (USR + PRMPT + QMD)
  44.     switch cmdstatus
  45.         case USR
  46.             changeuserinfo()
  47.         endcase
  48.         case PRMPT
  49.             changeprompts()
  50.         endcase
  51.         case QMD
  52.             changemaildoor()
  53.         endcase
  54.     endswitch
  55. endproc
  56.  
  57.  
  58. #comment
  59. *********************************************************************
  60. * CHANGEUSERINFO()
  61. * Called by main()
  62. * Calls makebbslist(), loadbbsinfo(), loadprompts(), 
  63. * loadmaildoor(), writebbsinfo(), writeprompts(), 
  64. * writemaildoor(), interfaceon(), insertbbs(),
  65. * bbsbox(), addbbs(), defaultsprompts(), defaultsdoor(), 
  66. * cfgprompts(), cfgmaildoor(), checkchanged(),
  67. * gettaskstring()
  68. * Puts up the BBS Information dialog box and allows the
  69. * user to change the values for the current BBS.  If the
  70. * the DEFAULTS flag is set, changes the DEFAULT BBS
  71. * settings.  If the NEW flag is set, calls addbbs().
  72. *********************************************************************
  73. #endcomment
  74.  
  75. proc changeuserinfo
  76. string LastBBS, LastBBSType, BBSid, char
  77. integer dialogstatus, NameChanged, i
  78.     if FLAGS & DEFAULTS
  79.         BBSList = "DEFAULT"
  80.         BBSChoice = "DEFAULT"
  81.         loadbbsinfo(MailRun, "DEFAULT")
  82.         loadprompts(MailRunIni, BBSType)
  83.         loadmaildoor(MailRunIni, MailDoorType)
  84.         findfirst MailRun
  85.         strfmt BBSName "BBS Info Defaults for %s" $FILENAME
  86.     else
  87.         makebbslist()
  88.         strextract BBSChoice TaskItem "`t" 3
  89.         loadbbsinfo(MailRun, BBSChoice)
  90.         loadprompts(MailRun, BBSChoice)
  91.         loadmaildoor(MailRun, BBSChoice)
  92.     endif
  93.     NameChanged = 0
  94.     LastBBS = BBSChoice
  95.     LastBBSType = BBSType
  96.     bbsbox()
  97.     interfaceon()
  98.     FLAGS &= UNCHANGED
  99.     if FLAGS & NEW
  100.         addbbs()
  101.         LastBBS = BBSChoice
  102.     endif
  103.     while 1
  104.         dialogstatus = $DIALOG
  105.         switch dialogstatus
  106.             case 10
  107.                 ;User selected "Prompts"
  108.                 if FLAGS & DEFAULTS
  109.                     defaultsprompts()
  110.                 else
  111.                     cfgprompts()
  112.                 endif
  113.             endcase
  114.             case 11
  115.                 ;User selected "Mail Door"
  116.                 if FLAGS & DEFAULTS
  117.                     defaultsdoor()
  118.                 else
  119.                     cfgmaildoor()
  120.                 endif
  121.             endcase
  122.             case 12
  123.                 ;User selected "Save"
  124.                 if NULLSTR BBSName
  125.                     usermsg "You must enter the name of the BBS!"
  126.                     loopwhile
  127.                 elseif FLAGS & NEW
  128.                     ;if it is a new BBS
  129.                     if not NULLSTR TaskItem
  130.                         ;if there are other BBSs in the mailrun
  131.                         strextract BBSid TaskItem "`t" 3
  132.                         insertbbs(BBSid, BBSChoice)
  133.                     else
  134.                         ;if this is the only BBS in the mailrun
  135.                         writebbs(1, BBSChoice)
  136.                     endif
  137.                     TaskItem = gettaskstring(BBSid, 0)
  138.                     FLAGS &= OLD
  139.                 endif
  140.                 if FLAGS & DEFAULTS
  141.                     writebbsinfo(MailRun, "DEFAULT")
  142.                     writeprompts(MailRunIni, BBSType)
  143.                     writemaildoor(MailRunIni, MailDoorType)
  144.                 else
  145.                     writebbsinfo(MailRun, BBSChoice)
  146.                     writeprompts(MailRun, BBSChoice)
  147.                     writemaildoor(MailRun, BBSChoice)
  148.                 endif
  149.                 strextract char TaskItem "`t" 4
  150.                 atoi char i
  151.                 if NameChanged && !(i)
  152.                     TaskItem = gettaskstring(BBSChoice, 0)
  153.                 endif
  154.                 FLAGS &= UNCHANGED
  155.             endcase
  156.             case 13
  157.                 ;User selected "Done:
  158.                 if checkchanged()
  159.                     exit
  160.                 endif
  161.             endcase
  162.             case 171
  163.                 ;User changed the BBS type
  164.                 if FLAGS & DEFAULTS
  165.                     if checkchanged()
  166.                         loadprompts(MailRunIni, BBSType)
  167.                         FLAGS &= UNCHANGED
  168.                         LastBBSType = BBSType
  169.                     else
  170.                         BBSType = LastBBSType
  171.                     endif
  172.                 else
  173.                     loadprompts(MailRunIni, BBSType)
  174.                 endif
  175.                 FLAGS |= CHANGED
  176.                 updatedlg -1
  177.             endcase
  178.             case 172
  179.                 ;User changed the mail door type
  180.                 if FLAGS & DEFAULTS
  181.                     loadmaildoor(MailRunIni, MailDoorType)
  182.                 else
  183.                     loadmaildoor(MailRunIni, MailDoorType)
  184.                 endif
  185.                 FLAGS |= CHANGED
  186.             endcase
  187.             case 173
  188.                 ;User changed BBS ID with combobox
  189.                 if checkchanged()
  190.                     loadbbsinfo(MailRun, BBSChoice)
  191.                     loadprompts(MailRun, BBSChoice)
  192.                     loadmaildoor(MailRun, BBSChoice)
  193.                     TaskItem = gettaskstring(BBSChoice, 0)
  194.                     FLAGS &= UNCHANGED
  195.                     LastBBS = BBSChoice
  196.                     updatedlg -1
  197.                 else
  198.                     BBSChoice = LastBBS
  199.                     updatedlg 512
  200.                 endif
  201.             endcase
  202.             case 230
  203.                 NameChanged = 1
  204.                 FLAGS |= CHANGED
  205.             endcase
  206.             case 70
  207.             case 170
  208.             case 231
  209.             case 232
  210.             case 233
  211.             case 234
  212.             case 235
  213.             case 236
  214.             case 237
  215.             case 238
  216.             case 239
  217.                 FLAGS |= CHANGED
  218.             endcase
  219.         endswitch
  220.     endwhile
  221. endproc
  222.  
  223.  
  224. #comment
  225. *********************************************************************
  226. * CHANGEPROMPTS()
  227. * Called by main()
  228. * Calls makebbslist(), promptbox(), loadprompts(),
  229. * writeprompts(), interfaceon(), defaultsbbs(), defaultsdoor(),
  230. * cfgbbs(), cfgmaildoor(), exportprompts(), checkchanged(),
  231. * gettaskstring()
  232. * Allows the user to change the prompts for a given BBS in
  233. * the *.MRN file.  If DEFAULTS flag is set, changes default
  234. * prompts for the current BBS type.
  235. *********************************************************************
  236. #endcomment
  237.  
  238. proc changeprompts
  239. string LastBBS, LastBBSType
  240. integer dialogstatus
  241.     if FLAGS & DEFAULTS
  242.         BBSList = "DEFAULT"
  243.         BBSChoice = "DEFAULT"
  244.         profilerd MailRun "DEFAULT" "BBSType" BBSType
  245.         loadprompts(MailRunIni, BBSType)
  246.     else
  247.         makebbslist()
  248.         strextract BBSChoice TaskItem "`t" 3
  249.         profilerd MailRun BBSChoice "BBSType" BBSType
  250.         loadprompts(MailRun, BBSChoice)
  251.     endif
  252.     LastBBS = BBSChoice
  253.     LastBBSType = BBSType
  254.     promptbox()
  255.     FLAGS &= UNCHANGED
  256.     interfaceon()
  257.     while 1
  258.         dialogstatus = $DIALOG
  259.         switch dialogstatus
  260.             case 10
  261.                 ;User selected "BBS Info"
  262.                 if FLAGS & DEFAULTS
  263.                     defaultsbbs()
  264.                 else
  265.                     cfgbbs()
  266.                 endif
  267.             endcase
  268.             case 11
  269.                 ;User selected "Mail Door"
  270.                 if FLAGS & DEFAULTS
  271.                     defaultsdoor()
  272.                 else
  273.                     cfgmaildoor()
  274.                 endif
  275.             endcase
  276.             case 12
  277.                 ;User selected "Export"
  278.                 exportprompts()
  279.             endcase
  280.             case 13
  281.                 ;User selected "Save"
  282.                 if FLAGS & DEFAULTS
  283.                     writeprompts(MailRunIni, BBSType)
  284.                 else
  285.                     writeprompts(MailRun, BBSChoice)
  286.                     profilewr MailRun BBSChoice "BBSType" BBSType
  287.                 endif
  288.                 FLAGS &= UNCHANGED
  289.             endcase
  290.             case 14
  291.                 ;User selected "Done"
  292.                 if checkchanged()
  293.                     exit
  294.                 endif
  295.             endcase
  296.             case 170
  297.                 ;User changed BBS with the combobox
  298.                 if checkchanged()
  299.                     loadprompts(MailRun, BBSChoice)
  300.                     profilerd MailRun BBSChoice "BBSType" BBSType
  301.                     TaskItem = gettaskstring(BBSChoice, 0)
  302.                     LastBBS = BBSChoice
  303.                     updatedlg -1
  304.                 else
  305.                     BBSChoice = LastBBS
  306.                     updatedlg 512
  307.                 endif
  308.             endcase
  309.             case 171
  310.                 ;User changed BBS type
  311.                 if FLAGS & DEFAULTS
  312.                     if checkchanged()
  313.                         loadprompts(MailRunIni, BBSType)
  314.                         updatedlg 128
  315.                         FLAGS &= UNCHANGED
  316.                         LastBBSType = BBSType
  317.                     else
  318.                         BBSType = LastBBSType
  319.                         updatedlg 512
  320.                     endif
  321.                 else
  322.                     loadprompts(MailRunIni, BBSType)
  323.                     updatedlg 128
  324.                     FLAG